import {
  ArrayMaxSize,
  ArrayMinSize,
  IsArray,
  IsEnum,
  IsNotEmpty,
  IsOptional,
  IsString,
  IsUUID,
} from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { BaseScrollPageDto } from '@/common/base/base.dto';
import { SimulationAlgoType } from 'common/utils/data';
import { Type } from 'class-transformer';

class Earbuds2EarbudsDtoTargets{
  @IsNotEmpty()
  @ApiProperty()
  @IsUUID()
  evaluationUuid: string;

  @IsNotEmpty()
  @ApiProperty()
  @IsString()
  dataGroup: string;
}
export class Earbuds2EarbudsDto {
  @IsNotEmpty()
  @ApiProperty()
  @IsUUID()
  currentEvaluationUuid: string;

  @IsNotEmpty()
  @ApiProperty()
  @IsString()
  currentDataGroup: string;

  @IsNotEmpty()
  @ApiProperty({
    type: [Earbuds2EarbudsDtoTargets]
  })
  @IsArray()
  @Type(()=>Earbuds2EarbudsDtoTargets)
  @ArrayMinSize(1)
  @ArrayMaxSize(10)
  targets: Earbuds2EarbudsDtoTargets[];

  @IsNotEmpty()
  @ApiProperty()
  @IsArray()
  @ArrayMinSize(1)
  @ArrayMaxSize(10)
  files: string[];

  @IsNotEmpty()
  @ApiProperty()
  @IsEnum(SimulationAlgoType)
  simulationAlgo: SimulationAlgoType;
}

export class BatchCheckStatusDto {
  @IsNotEmpty()
  @ApiProperty()
  @IsString()
  uuids: string;
}

export class AudioSynthesisIndexEarbuds2EarbudsDto extends BaseScrollPageDto {
  @IsOptional()
  @ApiPropertyOptional()
  @IsString()
  keyword?: string;

  @IsOptional()
  @ApiPropertyOptional()
  @IsString()
  uuids?: string;
}

export class AudioSynthesisBatchDto {
  @IsOptional()
  @ApiPropertyOptional()
  @IsString()
  uuids?: string;
}
